#ifndef LAURIN_CONTROLLER_H_
#define LAURIN_CONTROLLER_H_


#include "laurin-scan-result-model.h"
#include "../core/laurin-discover-network-clients-module.h"
#include "../core/laurin-discover-devices-module.h"
#include "../core/laurin-module-handler.h"
#include <glibmm/ustring.h>


struct LaurinControllerOptions
{

	public:

		static LaurinControllerOptions getDefault();
		bool areValid();
		Glib::ustring getErrorMessage() const;

		Glib::ustring NetworkDeviceName;
		Glib::ustring MonitorDeviceName;
		Glib::ustring MasterDeviceName;

		int MonitorCaptureInterval;
		int MonitorMaxCapturedFrame;
		int NetworkTimeout;
		bool EnableLocation;
		bool PassiveMode;


	private:

		Glib::ustring _errmess;

};




class LaurinController : public LaurinModuleHandler
{

	public:

		LaurinController();
		~LaurinController();

		LaurinControllerOptions getOptions() const;
		bool setOptions(LaurinControllerOptions options);

		bool start();
		bool stop(bool wait = false);


		LaurinScanResultModel* getScanResultModel();
		bool setDistanceBetweenMonitorAndAP(Glib::ustring bssid, double distance);


	private:


		LaurinControllerOptions _options;
		bool _modules_created;

		LaurinDiscoverDevicesModule* _devices_scan_module;
		LaurinDiscoverNetworkClientsModule* _network_client_scan_module;


		void invalidateModules(LaurinControllerOptions options);
		LaurinScanResultModel* fillResult();
		void clearResources();
		bool createModules();
};


#endif
